<?php echo $this->Html->script('jquery.dataTables.js'); ?>
<script type="text/javascript">
    $(document).ready(function() {
        $('#browserList').dataTable({
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "<?php echo $this->Html->Url(array('controller' => 'Online', 'action' => 'indexdata')); ?>"
        });
    });
</script>


   <div class="admin_left actions">
    <h3 style="font-size:20px;">Manage more</h3>
        <ul>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Online'), array('controller' => 'Online', 'action' => 'index'),array('class' => 'consistentButton2')); ?> </li>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Orders'), array('controller' => 'Online', 'action' => 'orders'),array('class' => 'consistentButton2')); ?> </li>
        </ul>
    </div>
<div id="pinkHeader" class="admin_right items index">
		<div id=breadcrumbAdmin>
	    	<?php $this->Html->addCrumb('Online sales', '/Online/index', array('style'=> ('text-decoration:underline; color:#EB1E70;'))); ?>
	        <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Transactions', 'url' => array('controller' => 'Sales', 'action' => 'index', 'plugin' => null), 'escape' => false)); ?>
	    </div>
    <div class="consigners index">
        <h2><?php echo __('Online sales'); ?></h2>
       <!-- <div id="search" style="text-align: left;">
            <?php
                //echo $this->Form->create('Online',array('action' => 'search'));
                //echo $this->Form->input('keyword', array('label' => 'Search for'));
            ?>
        </div>
		-->
		<table id="browserList" style="width:120%;" cellpadding="0" cellspacing="0" class="table table-bordered  table-hover">
    <thead>
        <tr>
            <th style="width:5%;">id</th>
			<th style="width:5%;">Email</th>
            <th style="width:15%;">Phone</th>
            <th style="width:20%;">Total</th>
            <th style="width:20%;">Address</th>       
            <th style="width:20%;">NO.of item</th>          
            <th style="width:20%;">Actions</th>         
        </tr>
    </thead>
    <tbody>
        <tr>
            <td colspan="4" class="dataTables_empty">Loading data from server...</td>
        </tr>
    </tbody>
</table>
		
     <!--   <table style="width:120%;" cellpadding="0" cellspacing="0" class="table table-bordered  table-hover">
        <tr>
				<th><?php //echo $this->Paginator->sort('email'); ?></th>
                <th><?php //echo $this->Paginator->sort('phone'); ?></th>
                <th  style="width:20%;">Total</th>
                <th  style="width:20%;">Address</th>
                <th  style="width:20%;">NO.of item</th>
                <th style="width:20%;" class="actions"><?php //echo __('Actions'); ?></th>
        </tr>

        <?php //foreach ($orders as $order): ?>
        <tr id="consigner_<?php //echo h($order['Order']['id']); ?>" class="consigner">
			<td><?php //echo h($order['Order']['email']); ?>&nbsp;</td>
            <td><?php //echo h($order['Order']['phone']); ?>&nbsp;</td>
            <td><?php //echo h($order['Order']['total']); ?>&nbsp;</td>
            <td  style="width:8%;"><?php //echo h($order['Order']['shipping_address']); ?>&nbsp;</td>
            <td  style="width:8%;"><?php //echo h($order['Order']['order_item_count']); ?>&nbsp;</td>
            <td class="actions">
                <?php //echo $this->Html->link(__('View detail'), "javascript:void(0);",array("class"=>"order_view","data-id"=> $order['Order']['id'])); ?>
            </td>
        </tr>
    <?php //endforeach; ?>
        </table>
        <p>-->
        <?php
     /*   echo $this->Paginator->counter(array(
        'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
        ));*/
        ?>	<!--</p>
        <div class="paging">-->
        <?php
      /*      echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
            echo $this->Paginator->numbers(array('separator' => ''));
            echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));*/
        ?><!--
        </div>-->
    </div>
<?php echo $this->Html->script('jquery-ui.js', array('inline' => false));?>
<?php echo $this->Html->css('ui-lightness/jquery.css', null, array('inline' => false)); ?>
<script type="text/javascript">
	$(document).ready(function(){
		$("#order_item_view").dialog({
			autoOpen: false,
			dialogClass:"web-app-sequence-dialog",
			width:920,
			modal:true,resizable:false,
			buttons:{
				"Close":function(){$("#order_item_view").dialog( "close" );}
				}
		});
		$(".order_view").click(function(){
			$("#order_item_view").empty();
			$("#order_item_view").dialog("open");
			var id=$(this).data("id");
			//fill in content
			$.get("<?php echo $webroot?>Online/orderdetail?id="+id, function(data){
				$("#order_item_view").html(data);
			});
		});
	});
</script>
</div>
<div id="order_item_view"></div>